package com.xmg.mgrsite.base;

import com.xmg.p2p.base.query.VideoAuthQueryObject;
import com.xmg.p2p.base.service.IUserinfoService;
import com.xmg.p2p.base.service.IVideoAuthService;
import com.xmg.p2p.base.util.JSONResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

/**
 * lcd  2020/5/19
 * Description:
 */
@Controller
public class VideoAuthController {
    @Autowired
    private IVideoAuthService videoAuthService;
    @Autowired
    private IUserinfoService userinfoService;

    @RequestMapping("vedioAuth")
    public String vedioAuth(@ModelAttribute("qo")VideoAuthQueryObject qo, Model model){
        model.addAttribute("pageResult", videoAuthService.queryPage(qo));
        return "vedioAuth/list";
    }
    /**
     * 完成视频审核
     */
    @RequestMapping("vedioAuth_audit")
    @ResponseBody
    public JSONResult vedioAuthAudit(Long loginInfoValue, String remark, int state){
        videoAuthService.audit(loginInfoValue,remark,state);
        return new JSONResult();
    }

    /**
     * 用于用户的automcomplate
     */
    @RequestMapping("vedioAuth_autocomplate")
    @ResponseBody
    public List<Map<String,Object>> autoComplate(String keyword){
        return userinfoService.autoComplate(keyword);
    }
}
